package LearnStatic;

/**
 *
 * static的应用
 *
 */
public class CircleTest {
    public static void main(String[] args) {
        Circle c1 = new Circle();
        Circle c2 = new Circle();
        System.out.println(c1.getId());
        System.out.println(c2.getId());
        System.out.println(c2.getTotal());

    }
}

class Circle{
    private double radius;
    private int id;

    private static int total;//记录创建的圆的个数
    private static int init = 1001;

    public double getRadius() {
        return radius;
    }

    public void setRadius(double radius) {
        this.radius = radius;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public static int getTotal() {
        return total;
    }

    public Circle(){
        id = init++;
        total++;
    }


    public double findArea(){
        return Math.PI * Math.pow(radius,2);
    }
}